﻿<EpiDashboard:GadgetBase x:Class="EpiDashboard.CombinedFrequencyControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:EpiDashboard="clr-namespace:EpiDashboard"          
    xmlns:Controls="clr-namespace:EpiDashboard.Controls"
    Style="{DynamicResource gadgetBaseStyle}">
    <EpiDashboard:GadgetBase.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../ResourceDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </EpiDashboard:GadgetBase.Resources>
    <Grid>
        <Controls:ShadowRectangle x:Name="rectangleShadow"></Controls:ShadowRectangle>
        <Border Name="borderAll" Style="{DynamicResource mainGadgetBorder}" >
            <Border.ContextMenu>
                <ContextMenu>
                    <MenuItem x:Name="mnuCopyData" Header="Copy data to clipboard"/>
                    <MenuItem x:Name="mnuSendDataToHTML" Header="Send data to web browser">
                        <MenuItem.Icon>
                            <Image Source="../../Images/saveHTML.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem x:Name="mnuSendDataToExcel" Header="Send data to Excel" />
                    <Separator/>
                    <MenuItem x:Name="mnuSendToBack" Header="Send gadget to back"/>
                    <!--<MenuItem x:Name="mnuRefresh" Header="Refresh this gadget">
                        <MenuItem.Icon>
                            <Image Source="Images/refresh1.png" />
                        </MenuItem.Icon>
                    </MenuItem>-->
                    <MenuItem x:Name="mnuClose" Header="Close this gadget"/>
                </ContextMenu>
            </Border.ContextMenu>

            <Grid x:Name="grdMain">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="0" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="0" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="0" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                <Controls:GadgetHeaderPanel x:Name="headerPanel" Grid.Row="0" Text="Combined Frequency" />
                <Controls:GadgetMessagePanel Margin="4" x:Name="messagePanel" Grid.Row="2" Text="" />
                <Controls:GadgetDescriptionPanel Grid.Row="4" PanelMode="Collapsed" x:Name="descriptionPanel"></Controls:GadgetDescriptionPanel>

                <!--<TextBlock Grid.Row="6" x:Name="txtFilterString" Style="{DynamicResource filterStringText}" Visibility="Collapsed" >
                </TextBlock>-->

                <Controls:GadgetInfoPanel Grid.Row="4" Visibility="Collapsed" Margin="4" x:Name="infoPanel"></Controls:GadgetInfoPanel>

                <StackPanel Grid.Row="7" x:Name="panelMain" HorizontalAlignment="Left" VerticalAlignment="Top"></StackPanel>

                <Controls:GadgetWaitPanel x:Name="waitPanel" Visibility="Collapsed" Grid.Row="1" Grid.RowSpan="6" Style="{DynamicResource gadgetWaitPanelStyle}" />

                <StackPanel Grid.Row="1" Grid.RowSpan="7" Margin="00,-15,-10,0"  HorizontalAlignment="Right" VerticalAlignment="Top" >
                    <Grid x:Name="ConfigGrid" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,10,0" >
                        <Rectangle Style="{DynamicResource rectangleConfigOuter}" />
                        <Rectangle Style="{DynamicResource rectangleConfigInner}" />

                        <Path x:Name="pathTriangle" 
                              Margin="0,-2,90,0"
                              Data="M 5 0 L 10 10 0 10 Z" Fill="{DynamicResource gadgetBackgroundBrush}" IsHitTestVisible="False" HorizontalAlignment="Right" VerticalAlignment="Top" Height="7" />                
                        
                        <StackPanel Orientation="Vertical" Margin="25, 10, 25, 25" HorizontalAlignment="Center" VerticalAlignment="Top" >
                            <TextBlock x:Name="ConfigExpandedTitle" HorizontalAlignment="Center" TextAlignment="Center" Margin="5" FontWeight="Bold">
                                Combined Frequency<LineBreak />Properties
                            </TextBlock>

                            <TextBlock x:Name="tblockGroupField" HorizontalAlignment="Left" TextAlignment="Center" Text="Group field:" Margin="0,5,0,0"  />
                            <ComboBox x:Name="cbxField" Width="150" HorizontalAlignment="Left" SelectedIndex="0" />

                            <Grid x:Name="grdAdvancedOptionsHeading">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                </Grid.ColumnDefinitions>                                
                            </Grid>

                            <Expander Margin="0, 5, 0, 0" x:Name="expanderAdvancedOptions" Header="Advanced options">                            
                                <StackPanel>
                                    <TextBlock HorizontalAlignment="Left" TextAlignment="Center" Text="Stratify by:" Margin="0,5,0,0" Visibility="Collapsed" />
                                    <ComboBox x:Name="cmbFieldStrata" Width="120" HorizontalAlignment="Left" SelectedIndex="0" Visibility="Collapsed" />

                                    <TextBlock x:Name="tblockCombineMode" HorizontalAlignment="Left" TextAlignment="Center" Text="Combine mode:" Margin="0,7,0,0" Visibility="Visible" />
                                    <ComboBox x:Name="cmbCombineMode" Width="180" HorizontalAlignment="Left" SelectedIndex="0" Visibility="Visible" Margin="0,0,0,0" SelectionChanged="cmbCombineMode_SelectionChanged">
                                        <ComboBoxItem>Automatic</ComboBoxItem>
                                        <ComboBoxItem>Boolean</ComboBoxItem>
                                        <ComboBoxItem>Categorical</ComboBoxItem>
                                    </ComboBox>

                                    <TextBlock x:Name="tblockTrueValue" HorizontalAlignment="Left" TextAlignment="Center" Text="Value to treat as true:" Margin="0,12,0,0" Visibility="Collapsed" />
                                    <TextBox x:Name="txtTrueValue" Width="180" HorizontalAlignment="Left" Visibility="Collapsed" />

                                    <CheckBox x:Name="checkboxSortHighLow" Margin="0,12,0,0" Content="Sort high to low" HorizontalAlignment="Left" IsChecked="true" />
                                    <CheckBox x:Name="checkboxShowDenominator" Margin="0,12,0,0" Content="Show denominator" HorizontalAlignment="Left" IsChecked="true" />
                                    
                                </StackPanel>
                            </Expander>

                            <Button x:Name="btnRun" Content="Run" Margin="0,14,0,0" Click="btnRun_Click" />

                        </StackPanel>
            </Grid>
        </StackPanel>                
            </Grid>
        </Border>        
    </Grid>
</EpiDashboard:GadgetBase>
